Conrad removes implicit conversion to time_t.
authorrobertlipe <robertlipe@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Thu, 15 Aug 2013 18:02:50 +0000 (18:02 +0000)
committerrobertlipe <robertlipe@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Thu, 15 Aug 2013 18:02:50 +0000 (18:02 +0000)
68 files changed:
gpsbabel/alan.cc
gpsbabel/an1.cc
gpsbabel/cetus.cc
gpsbabel/coastexp.cc
gpsbabel/compegps.cc
gpsbabel/copilot.cc
gpsbabel/csv_util.cc
gpsbabel/delbin.cc
gpsbabel/delgpl.cc
gpsbabel/exif.cc
gpsbabel/garmin.cc
gpsbabel/garmin_txt.cc
gpsbabel/gcdb.cc
gpsbabel/gdb.cc
gpsbabel/geoniche.cc
gpsbabel/ggv_log.cc
gpsbabel/gnav_trl.cc
gpsbabel/gopal.cc
gpsbabel/gpilots.cc
gpsbabel/gpspilot.cc
gpsbabel/gpsutil.cc
gpsbabel/gpx.cc
gpsbabel/gtm.cc
gpsbabel/gtrnctr.cc
gpsbabel/hiketech.cc
gpsbabel/holux.cc
gpsbabel/html.cc
gpsbabel/humminbird.cc
gpsbabel/igc.cc
gpsbabel/ignrando.cc
gpsbabel/igo8.cc
gpsbabel/interpolate.cc
gpsbabel/itracku.cc
gpsbabel/jtr.cc
gpsbabel/kml.cc
gpsbabel/lowranceusr.cc
gpsbabel/lowranceusr4.cc
gpsbabel/magnav.cc
gpsbabel/magproto.cc
gpsbabel/main.cc
gpsbabel/mapasia.cc
gpsbabel/mapbar_track.cc
gpsbabel/mapsend.cc
gpsbabel/mapsource.cc
gpsbabel/nmea.cc
gpsbabel/osm.cc
gpsbabel/ozi.cc
gpsbabel/palmdoc.cc
gpsbabel/pathaway.cc
gpsbabel/pcx.cc
gpsbabel/pocketfms_bc.cc
gpsbabel/psitrex.cc
gpsbabel/quovadis.cc
gpsbabel/raymarine.cc
gpsbabel/route.cc
gpsbabel/skyforce.cc
gpsbabel/smplrout.cc
gpsbabel/sort.cc
gpsbabel/src/core/datetime.h
gpsbabel/stmsdf.cc
gpsbabel/stmwpp.cc
gpsbabel/subrip.cc
gpsbabel/text.cc
gpsbabel/trackfilter.cc
gpsbabel/unicsv.cc
gpsbabel/vitosmt.cc
gpsbabel/waypt.cc
gpsbabel/wfff_xml.cc

index 42589974c0756d426f5d3a46870c64416935a6ed..4165863c3794cae41b8c92661eed887d19f4887d 100644 (file)
@@ -702,7 +702,7 @@ static int add_wpt(struct wprdata* wprdata, const waypoint* WP,int isroute)
   wpt->usecount = isroute ? 1 : 0;
   wpt->checked  = isroute ? 0 : 1;
   wpt->reserved = 0;
-  pack_time(WP->GetCreationTime(), &(wpt->date), &(wpt->time));
+  pack_time(WP->GetCreationTime().toTime_t(), &(wpt->date), &(wpt->time));
 
   wpthdr->idx[hdr_idx] = wpt_idx;
   wpthdr->used[wpt_idx] = WPT_USED;
index d8f65ac6f078ee50eeef29aacde32dd6d4ab25aa..b501a12112afa8b67200ce4be124d47367647471 100644 (file)
@@ -798,7 +798,7 @@ Write_One_AN1_Waypoint(const waypoint* wpt)
   }
 
 
-  rec->creation_time = rec->modification_time = wpt->GetCreationTime();
+  rec->creation_time = rec->modification_time = wpt->GetCreationTime().toTime_t();
   rec->lat = EncodeOrd(wpt->latitude);
   rec->lon = EncodeOrd(-wpt->longitude);
   rec->serial = serial++;
index 58f9fb03233ab7e16ec2170e39305b62070d3e40..d5d05e3b6056d0a99fc38f827e7194500c73b734 100644 (file)
@@ -605,7 +605,7 @@ data_write(void)
   }
   file_out->name[PDB_DBNAMELEN-1] = 0;
   file_out->attr = PDB_FLAG_BACKUP;
-  file_out->ctime = file_out->mtime = current_time() + 2082844800U;
+  file_out->ctime = file_out->mtime = current_time().toTime_t() + 2082844800U;
   file_out->type = MYTYPE_WPT;  /* CWpt */
   file_out->creator = MYCREATOR; /* cGPS */
   file_out->version = 1;
index 5c2e3ade67ce2423faebfecfa7da2b8d2ae13200..e25c0e54ac77307ef52785f3466dc8e3908f73d8 100644 (file)
@@ -532,7 +532,7 @@ ce_gen_creation_time(time_t tm)
 static QString
 ce_gen_current_time(void)
 {
-  return ce_gen_creation_time(current_time());
+  return ce_gen_creation_time(current_time().toTime_t());
 }
 
 /* Generate a UUID (has same format as Microsoft registry GUIDs */
@@ -660,7 +660,7 @@ ce_mark_pr(const waypoint* wp)
     id = xml_buffer;
   }
   write_xml_entity_begin2(ofd, "\t", "Mark",
-                          "created", ce_gen_creation_time(wp->GetCreationTime()),
+                          "created", ce_gen_creation_time(wp->GetCreationTime().toTime_t()),
                           "id", id);
   ce_waypt_pr(wp);
   write_xml_entity_end(ofd, "\t", "Mark");
@@ -699,7 +699,7 @@ ce_write(void)
      the standalone waypoints.
   */
   time_t now = 0;
-  now = current_time();
+  now = current_time().toTime_t();
 
   write_xml_header(ofd);
   write_xml_entity_begin1(ofd, "", "NavObjectCollection", "created",
index a0e46f2d876c4b3247feb2c912bfdff9f9c0ed67..233dc41619a26372833935049d83ff434324beeb 100644 (file)
@@ -564,7 +564,7 @@ write_trkpt_cb(const waypoint* wpt)
 // TOOD: This should probably attempt a gmtime and then fall back to the 1-1-1970
 // case or bypass the time_t completely and build string representations directly.
   if (wpt->creation_time.isValid()) {
-    const time_t tt = wpt->GetCreationTime();
+    const time_t tt = wpt->GetCreationTime().toTime_t();
     struct tm tm = *gmtime(&tt);
 
     strftime(buff, sizeof(buff), "%d-%b-%y %H:%M:%S", &tm);
index 67267214375ff995619df1f653605cdadbc2c6a0..58693114338591ffc0a56824027452d29275c2da 100644 (file)
@@ -294,7 +294,7 @@ data_write(void)
   strncpy(file_out->name, out_fname, PDB_DBNAMELEN);
   file_out->name[PDB_DBNAMELEN-1] = 0;
   file_out->attr = PDB_FLAG_BACKUP;
-  file_out->ctime = file_out->mtime = current_time() + 2082844800U;
+  file_out->ctime = file_out->mtime = current_time().toTime_t() + 2082844800U;
   file_out->type = wayp_TYPE;
   file_out->creator = GXPU_CREATOR;
   file_out->version = 4;
index 3c8700cfaeb30e56a2ab4a7f2d120364b67f9aa8..c24f893d5575b84baccde41ef90010969f05fa6e 100644 (file)
@@ -910,6 +910,13 @@ writetime(char* buff, size_t bufsize, const char* format, time_t t, bool gmt)
   return strftime(buff, bufsize, format, stmp);
 }
 
+static
+int
+writetime(char* buff, size_t bufsize, const char* format, const gpsbabel::DateTime& t, bool gmt)
+{
+  return writetime(buff, bufsize, format, t.toTime_t(), gmt);
+}
+
 static
 int
 writehms(char* buff, size_t bufsize, const char* format, time_t t, int gmt)
@@ -932,6 +939,13 @@ writehms(char* buff, size_t bufsize, const char* format, time_t t, int gmt)
                   (stmp->tm_hour>=12?"PM":"AM"));
 }
 
+static
+int
+writehms(char* buff, size_t bufsize, const char* format, const gpsbabel::DateTime& t, int gmt)
+{
+  return writehms(buff, bufsize, format, t.toTime_t(), gmt);
+}
+
 static
 long
 time_to_yyyymmdd(QDateTime t)
@@ -1907,7 +1921,7 @@ xcsv_waypt_pr(const waypoint* wpt)
       /* TIME CONVERSIONS**************************************************/
     case XT_EXCEL_TIME:
       /* creation time as an excel (double) time */
-      writebuff(buff, fmp->printfc, TIMET_TO_EXCEL(wpt->GetCreationTime()));
+      writebuff(buff, fmp->printfc, TIMET_TO_EXCEL(wpt->GetCreationTime().toTime_t()));
       break;
     case XT_TIMET_TIME:
       /* time as a time_t variable */ {
index bb3e5e1d3aaf26f302ed96b2a7318f895e47a889..d5a59039c9759e1ae0726caee4b5920c695355fc 100644 (file)
@@ -1279,7 +1279,7 @@ get_gc_notes(const waypoint* wp, int* symbol, char** notes, unsigned* notes_size
       }
       logpart = xml_findfirst(curlog, "groundspeak:date");
       if (logpart) {
-        time_t logtime = xml_parse_time(logpart->cdata);
+        time_t logtime = xml_parse_time(logpart->cdata).toTime_t();
         const struct tm* logtm = gmtime(&logtime);
         gbfprintf(fd, "%d-%02d-%02d ", logtm->tm_year + 1900, logtm->tm_mon + 1, logtm->tm_mday);
       }
@@ -1414,7 +1414,7 @@ write_waypoint(const waypoint* wp)
   waypoint_i++;
   le_write32(p->total, waypoint_n);
   le_write32(p->index, waypoint_i);
-  encode_time(wp->GetCreationTime(), &p->year);
+  encode_time(wp->GetCreationTime().toTime_t(), &p->year);
   le_write32(p->latitude, delbin_deg2rad(wp->latitude));
   le_write32(p->longitude, delbin_deg2rad(wp->longitude));
   if (wp->altitude > unknown_alt) {
@@ -1713,7 +1713,7 @@ write_track_points(void)
       le_write32(p->index, i + 1);
     }
     assert(p);
-    encode_time(wp->GetCreationTime(), &p->point[j].year);
+    encode_time(wp->GetCreationTime().toTime_t(), &p->point[j].year);
     le_write32(p->point[j].latitude, delbin_deg2rad(wp->latitude));
     le_write32(p->point[j].longitude, delbin_deg2rad(wp->longitude));
     f = UNKNOWN_ELEV;
@@ -1793,10 +1793,10 @@ write_track_end(const route_head* track)
   if (track->rte_name) {
     strncpy(p->name, track->rte_name, sizeof(p->name) - 1);
   } else {
-    sprintf(p->name, "%lu", (long)wp_array[0]->GetCreationTime());
+    sprintf(p->name, "%lu", (long)wp_array[0]->GetCreationTime().toTime_t());
   }
   le_write32(p->total_points, waypoint_n);
-  encode_time(current_time(), &p->year);
+  encode_time(current_time().toTime_t(), &p->year);
   le_write16(p->color, track_color_index(track->line_color.bbggrr));
   le_write16(p->comment_size, comment_size);
   if (comment_size) {
@@ -2186,7 +2186,7 @@ write_route_end(const route_head* route)
   if (route->rte_name) {
     strncpy(p->name, route->rte_name, sizeof(p->name) - 1);
   } else {
-    sprintf(p->name, "%lu", (long)wp_array[0]->GetCreationTime());
+    sprintf(p->name, "%lu", (long)wp_array[0]->GetCreationTime().toTime_t());
   }
   p->type = 0;
   le_write32(p->total_route_point, route_point_n);
index a51c1d870a3a68088b5b44cd37a1e78bd3ae0682..eb83d11e7f801ec67772d659da0a170951aa7ee1 100644 (file)
@@ -154,7 +154,7 @@ gpl_trackpt(const waypoint* wpt)
   le_write_double(&gp.alt, alt_feet);
   le_write_double(&gp.speed, speed);
   le_write_double(&gp.heading, heading);
-  le_write32(&gp.tm, wpt->GetCreationTime());
+  le_write32(&gp.tm, wpt->GetCreationTime().toTime_t());
 
   gbfwrite(&gp, sizeof(gp), 1, gplfile_out);
 }
index 8823426978e1d3d2792601d6e8a2ede82c6956ee..ff304143a426bee67dcf230f6c5735f7da5b77bb 100644 (file)
@@ -1112,7 +1112,7 @@ exif_find_wpt_by_time(const waypoint* wpt)
 
   if (exif_wpt_ref == NULL) {
     exif_wpt_ref = wpt;
-  } else if (abs(exif_time_ref - wpt->creation_time) < abs(exif_time_ref - exif_wpt_ref->creation_time)) {
+  } else if (abs(exif_time_ref - wpt->creation_time.toTime_t()) < abs(exif_time_ref - exif_wpt_ref->creation_time.toTime_t())) {
     exif_wpt_ref = wpt;
   }
 }
@@ -1460,12 +1460,12 @@ exif_write(void)
 
     if (exif_wpt_ref == NULL) {
       warning(MYNAME ": No point with a valid timestamp found.\n");
-    } else if (abs(exif_time_ref - exif_wpt_ref->creation_time) > frame) {
+    } else if (abs(exif_time_ref - exif_wpt_ref->creation_time.toTime_t()) > frame) {
       warning(MYNAME ": No matching point found for image date %s!\n", str);
       if (exif_wpt_ref != NULL) {
-        char* str = exif_time_str(exif_wpt_ref->creation_time);
+        char* str = exif_time_str(exif_wpt_ref->creation_time.toTime_t());
         warning(MYNAME ": Best is from %s, %d second(s) away.\n",
-                str, abs(exif_time_ref - exif_wpt_ref->creation_time));
+                str, abs(exif_time_ref - exif_wpt_ref->creation_time.toTime_t()));
         xfree(str);
       }
       exif_wpt_ref = NULL;
@@ -1499,11 +1499,11 @@ exif_write(void)
       exif_put_double(GPS_IFD, GPS_IFD_TAG_ALT, 0, wpt->altitude);
     }
 
-    if (wpt->creation_time) {
+    if (wpt->creation_time.isValid()) {
       struct tm tm;
       char buf[32];
 
-      const time_t tt = wpt->GetCreationTime();
+      const time_t tt = wpt->GetCreationTime().toTime_t();
       tm = *gmtime(&tt);
 
       tm.tm_year += 1900;
index eab301650ce2c4d3508843f25747a6a0fb5e3e6f..cc8e3cd25a80e24336ed666b515b47a744453408 100644 (file)
@@ -133,7 +133,7 @@ rw_init(const char* fname)
    * an affected unit.
    */
   if (resettime) {
-    GPS_Command_Send_Time(fname, current_time());
+    GPS_Command_Send_Time(fname, current_time().toTime_t());
     return;
   }
 
@@ -418,7 +418,7 @@ unsigned int checkWayPointIsAtSplit(waypoint* wpt, GPS_PLap* laps, int nlaps)
     int i;
     for (i=(nlaps-1); i >= 0; i--) {
       GPS_PLap lap = laps[i];
-      time_t delta = lap->start_time - wpt->GetCreationTime();
+      time_t delta = lap->start_time - wpt->GetCreationTime().toTime_t();
       if ((delta >= -1) && (delta <= 1)) {
         result = 1;
         break;
index 72349dfbdd381bb09a552bfa63f625b19a1cb731..922e5eb89b23dc7297cf38c6959091660013de58 100644 (file)
@@ -255,11 +255,11 @@ prework_wpt_cb(const waypoint* wpt)
   waypoint* prev = cur_info->prev_wpt;
 
   if (prev != NULL) {
-    cur_info->time += (wpt->GetCreationTime() - prev->GetCreationTime());
+    cur_info->time += (wpt->GetCreationTime().toTime_t() - prev->GetCreationTime().toTime_t());
     cur_info->length += waypt_distance_ex(prev, wpt);
   } else {
     cur_info->first_wpt = (waypoint*)wpt;
-    cur_info->start = wpt->GetCreationTime();
+    cur_info->start = wpt->GetCreationTime().toTime_t();
   }
   cur_info->prev_wpt = (waypoint*)wpt;
   cur_info->count++;
@@ -618,7 +618,7 @@ write_waypt(const waypoint* wpt)
   print_string("%s\t", GMSD_GET(state, ""));
   country = gt_get_icao_country(GMSD_GET(cc, ""));
   print_string("%s\t", (country != NULL) ? country : "");
-  print_date_and_time(wpt->GetCreationTime(), 0);
+  print_date_and_time(wpt->GetCreationTime().toTime_t(), 0);
   if (wpt->HasUrlLink()) {
     UrlLink l = wpt->GetUrlLink();
     print_string("%s\t", l.url_);
@@ -724,7 +724,7 @@ track_disp_wpt_cb(const waypoint* wpt)
   gbfprintf(fout, "Trackpoint\t");
 
   print_position(wpt);
-  print_date_and_time(wpt->GetCreationTime(), 0);
+  print_date_and_time(wpt->GetCreationTime().toTime_t(), 0);
   if IS_VALID_ALT(wpt->altitude) {
     print_distance(wpt->altitude, 1, 0, 0);
   }
@@ -738,7 +738,7 @@ track_disp_wpt_cb(const waypoint* wpt)
   if (prev != NULL) {
     float temp;
     gbfprintf(fout, "\t");
-    delta = wpt->GetCreationTime() - prev->GetCreationTime();
+    delta = wpt->GetCreationTime().toTime_t() - prev->GetCreationTime().toTime_t();
     temp = WAYPT_GET(wpt, temperature, -999);
     if (temp != -999) {
       print_temperature(temp);
index e24993e703db6b0657a3a37f7e2bad668e5a2765..ec2f2f4ed441b4b7065d1c513d689214b8329dec 100644 (file)
@@ -286,7 +286,7 @@ data_write(void)
   strncpy(file_out->name, "GeocachingDB", PDB_DBNAMELEN);
   file_out->name[PDB_DBNAMELEN-1] = 0;
   file_out->attr = PDB_FLAG_BACKUP;
-  file_out->ctime = file_out->mtime = current_time() + 2082844800U;
+  file_out->ctime = file_out->mtime = current_time().toTime_t() + 2082844800U;
   file_out->type = MYTYPE;  /* CWpt */
   file_out->creator = MYCREATOR; /* cGPS */
   file_out->version = 1;
index 0fa4f77d607147ecb5472ddbaa4b101f7caf6b4b..9efec606a0930122b2bd22e3eaa708154ee619f2 100644 (file)
@@ -1404,7 +1404,7 @@ write_waypoint(
 
   FWRITE_i16(GMSD_GET(category, gdb_category));
   FWRITE_DBL(WAYPT_GET(wpt, temperature, 0), 0);
-  FWRITE_TIME(wpt->GetCreationTime());
+  FWRITE_TIME(wpt->GetCreationTime().toTime_t());
 
   /* VERSION DEPENDENT CODE */
   if (gdb_ver >= GDB_VER_3) {
@@ -1586,7 +1586,7 @@ write_track(const route_head* trk, const char* trk_name)
     FWRITE_LATLON(wpt->latitude);
     FWRITE_LATLON(wpt->longitude);
     FWRITE_DBL(wpt->altitude, unknown_alt);
-    FWRITE_TIME(wpt->GetCreationTime());
+    FWRITE_TIME(wpt->GetCreationTime().toTime_t());
     d = WAYPT_GET(wpt, depth, unknown_alt);
     FWRITE_DBL(d, unknown_alt);
     d = WAYPT_GET(wpt, temperature, -99999);
index a983ba5bd3bfbd5920281cb8e21060e57656bcd1..d19789b66e2704aab627548f03295d71a3f04b11 100644 (file)
@@ -822,7 +822,7 @@ data_write(void)
   file_out->name[PDB_DBNAMELEN-1] = 0;
 
   file_out->attr = PDB_FLAG_BACKUP;
-  file_out->ctime = file_out->mtime = current_time() + (49*365 + 17*366) * (60*60*24);
+  file_out->ctime = file_out->mtime = current_time().toTime_t() + (49*365 + 17*366) * (60*60*24);
   file_out->type = MYTYPE_ASC;
   file_out->creator = MYCREATOR;
   file_out->version = 0;
index e8cfa33ad3281afedc66491b2f12858d16e63cbd..71850ebca2c07fdfbba49267c48612803ee8fb32 100644 (file)
@@ -223,7 +223,7 @@ ggv_log_track_head_cb(const route_head* trk)
     latsec = 60.0 * (latmin - floor(latmin));
     lonsec = 60.0 * (lonmin - floor(lonmin));
 
-    if (wpt->creation_time > 0) {
+    if (wpt->creation_time.isValid()) {
       time_t t = wpt->GetCreationTime().toTime_t();
       tm = *gmtime(&t);
       tm.tm_mon += 1;
@@ -238,7 +238,7 @@ ggv_log_track_head_cb(const route_head* trk)
                  wpt->latitude, wpt->longitude);
       speed = waypt_speed(prev, wpt);
     }
-    if (wpt->creation_time > 0) {
+    if (wpt->creation_time.isValid()) {
       secs = (double)tm.tm_sec + wpt->GetCreationTime().time().msec() / 1000.0;
     }
 
index 5abbca3788de7cc90df04d6c2f0480daee15bdf0..c485578479dfafebcd7ab30cfae573860583d33a 100644 (file)
@@ -118,7 +118,7 @@ gnav_trl_write_trkpt(const waypoint* wpt)
 {
   gnav_trl_t rec;
 
-  le_write32(&rec.time, wpt->GetCreationTime());
+  le_write32(&rec.time, wpt->GetCreationTime().toTime_t());
   le_write_float(&rec.lat, wpt->latitude);
   le_write_float(&rec.lon, wpt->longitude);
   if (wpt->altitude != unknown_alt) {
index c3f305086c926205021b3083dfd36b5236c53233..3bb16ce7dd8b5a4d4b1bd23a4a0c55f88e6c6105 100644 (file)
@@ -314,7 +314,8 @@ gopal_read(void)
     //calculate the speed to reach this waypoint from the last. This way I try to sort out invalid waypoints
     speed=0;
     if (lastwpt !=NULL) {
-      speed=3.6*radtometers(gcdist(RAD(lastwpt->latitude), RAD(lastwpt->longitude), RAD(wpt->latitude), RAD(wpt->longitude))) / abs(wpt->creation_time - lastwpt->GetCreationTime());
+      speed=3.6*radtometers(gcdist(RAD(lastwpt->latitude), RAD(lastwpt->longitude), RAD(wpt->latitude), RAD(wpt->longitude))) /
+          abs(wpt->creation_time.toTime_t() - lastwpt->GetCreationTime().toTime_t());
       //printf("speed line %d %lf \n",line,speed);
     }
     /* Error handling: in the tracklog of my device sometimes "jump" waypoints ;-) */
@@ -372,7 +373,7 @@ gopal_write_waypt(const waypoint* wpt)
     }
   }
   //MSVC handles time_t as int64, gcc and mac only int32, so convert it:
-  timestamp=(unsigned long)wpt->GetCreationTime();
+  timestamp=(unsigned long)wpt->GetCreationTime().toTime_t();
   gbfprintf(fout, "%lu, %s, %lf, %lf, %5.1lf, %8.5lf, %d, %lf, %d\n",timestamp,tbuffer,  wpt->longitude, wpt->latitude,wpt->altitude,
             wpt->speed,fix,wpt->hdop,wpt->sat);
 }
index 4e732359a6669206e4c7a2764c9e8ca77a982180..64dae8a95e4f694d38635a63a983ddd1f7932d66 100644 (file)
@@ -408,7 +408,7 @@ data_write(void)
    */
   file_out->name[PDB_DBNAMELEN-1] = 0;
   file_out->attr = PDB_FLAG_BACKUP;
-  file_out->ctime = file_out->mtime = current_time() + 2082844800U;
+  file_out->ctime = file_out->mtime = current_time().toTime_t() + 2082844800U;
 
   file_out->type = MYWPT;
   file_out->creator = MYCREATOR;
index c3dad5d8dda43a0d71d70284859bee6b85820d5b..55f8378650faa26070e2c34d2a31095d124c5e66 100644 (file)
@@ -209,7 +209,7 @@ data_write(void)
   }
   file_out->name[PDB_DBNAMELEN-1] = 0;
   file_out->attr = PDB_FLAG_BACKUP;
-  file_out->ctime = file_out->mtime = current_time() + 2082844800U;
+  file_out->ctime = file_out->mtime = current_time().toTime_t() + 2082844800U;
   file_out->type = MYTYPE_POINTS;
   file_out->creator = MYCREATOR;
   file_out->version = 0;
index 7e8b621ce095b283f0f01e42b0653794391cf252..f06825460e434dbf0fb5663a6eed6dd4ed1932a8 100644 (file)
@@ -72,7 +72,7 @@ data_read(void)
    * Make sure that all waypoints in single read have same
    * timestamp.
    */
-  time_t now = current_time();
+  time_t now = current_time().toTime_t();
   icon[0] = 0;
 
   while ((ibuf = gbfgetstr(file_in))) {
index a8b5c64b41c28fa3a5c4155346f5f28e77fe70dd..410b726a80ea5f6709dd88dee9fe17b42f097eaf 100644 (file)
@@ -1017,7 +1017,7 @@ gpx_end(void* data, const XML_Char* xml_el)
     waypt_alloc_gc_data(wpt_tmp)->placer = cdatastrp;
     break;
   case tt_cache_log_date:
-    gc_log_date = xml_parse_time(cdatastrp);
+    gc_log_date = xml_parse_time(cdatastrp).toTime_t();
     break;
     /*
      * "Found it" logs follow the date according to the schema,
@@ -1026,7 +1026,7 @@ gpx_end(void* data, const XML_Char* xml_el)
      */
   case tt_cache_log_type:
     if ((0 == strcmp(cdatastrp, "Found it")) &&
-        (0 == wpt_tmp->gc_data->last_found)) {
+        (0 == wpt_tmp->gc_data->last_found.toTime_t())) {
       waypt_alloc_gc_data(wpt_tmp)->last_found = gc_log_date;
     }
     gc_log_date = 0;
index a7981a470225b4c925414fe9bfa31f6fd1f9329c..c8737207fd4eb9fcfb3f96fa16d5f69c7c8b0028 100644 (file)
@@ -535,7 +535,7 @@ gtm_read(void)
     }
     fread_discard(file_in, 1);
     wpt->creation_time = fread_long(file_in);
-    if (wpt->creation_time) {
+    if (wpt->creation_time.isValid()) {
       wpt->creation_time += EPOCH89DIFF;
     }
     fread_discard(file_in, 2);
@@ -563,7 +563,7 @@ gtm_read(void)
     wpt->longitude = fread_double(file_in);
     convert_datum(&wpt->latitude, &wpt->longitude);
     wpt->SetCreationTime(fread_long(file_in));
-    if (wpt->creation_time) {
+    if (wpt->creation_time.isValid()) {
       wpt->creation_time += EPOCH89DIFF;
     }
     start_new = fread_byte(file_in);
@@ -641,8 +641,8 @@ static void write_waypt(const waypoint* wpt)
   fwrite_string(file_out, wpt->description);
   fwrite_integer(file_out, icon_from_descr(wpt->icon_descr));
   fwrite_byte(file_out, 3);
-  if (wpt->creation_time) {
-    fwrite_long(file_out, wpt->GetCreationTime()-EPOCH89DIFF);
+  if (wpt->creation_time.isValid()) {
+    fwrite_long(file_out, wpt->GetCreationTime().toTime_t()-EPOCH89DIFF);
   } else {
     fwrite_long(file_out, 0);
   }
@@ -665,7 +665,7 @@ static void write_trk_waypt(const waypoint* wpt)
 {
   fwrite_double(file_out, wpt->latitude);
   fwrite_double(file_out, wpt->longitude);
-  fwrite_long(file_out, wpt->GetCreationTime()-EPOCH89DIFF);
+  fwrite_long(file_out, wpt->GetCreationTime().toTime_t()-EPOCH89DIFF);
   fwrite_byte(file_out, start_new);
   if (wpt->altitude == unknown_alt) {
     fwrite_single(file_out, unknown_alt_gtm);
index 539367e34bfbcf1842a17f6912f7a51502538962..737b15f4a6846dc8c1092e470031490690629d1c 100644 (file)
@@ -262,13 +262,13 @@ gtc_new_study_lap(const route_head* rte)
 static void
 gtc_study_lap(const waypoint* wpt)
 {
-  if (wpt->creation_time && (gtc_least_time == 0)) {
+  if (wpt->creation_time.isValid() && (!gtc_least_time.isValid())) {
     gtc_least_time = wpt->GetCreationTime();
     gtc_start_lat = wpt->latitude;
     gtc_start_long = wpt->longitude;
   }
 
-  if (wpt->creation_time && (gtc_least_time > wpt->GetCreationTime())) {
+  if (wpt->creation_time.isValid() && (gtc_least_time > wpt->GetCreationTime())) {
     gtc_least_time = wpt->GetCreationTime();
     gtc_start_lat = wpt->latitude;
     gtc_start_long = wpt->longitude;
@@ -289,7 +289,7 @@ gtc_waypt_pr(const waypoint* wpt)
     gtc_write_xml(1, "<Trackpoint>\n");
   }
 
-  if (wpt->creation_time) {
+  if (wpt->creation_time.isValid()) {
     QString time_string = wpt->CreationTimeXML();
     if (!time_string.isEmpty()) {
       gtc_write_xml(0, "<Time>%s</Time>\n",
@@ -340,8 +340,8 @@ static void
 gtc_fake_hdr(void)
 {
   long secs = 0;
-  if (gtc_least_time && gtc_most_time) {
-    secs = gtc_most_time - gtc_least_time;
+  if (gtc_least_time.isValid() && gtc_most_time.isValid()) {
+    secs = gtc_most_time.toTime_t() - gtc_least_time.toTime_t();
   }
 
   /* write these in either case, course or activity format */
@@ -392,11 +392,11 @@ gtc_act_hdr(const route_head* rte)
   gtc_lap_start(NULL);
   gtc_new_study_lap(rte);
   route_disp(rte, gtc_study_lap);
-  if (gtc_least_time) {
+  if (gtc_least_time.isValid()) {
     gtc_write_xml(0, "<Id>%s</Id>\n",
-                      gtc_least_time.toPrettyString().toUtf8().data());
+                      CSTR(gtc_least_time.toPrettyString()));
     gtc_write_xml(1, "<Lap StartTime=\"%s\">\n",
-                      gtc_least_time.toPrettyString().toUtf8().data());
+                      CSTR(gtc_least_time.toPrettyString()));
   } else {
     gtc_write_xml(1, "<Lap>\n");
   }
index 13c3a720260eda257ca4440c87afa4a6e63464bf..7f9488fff0019ca81317449b8adfc8c9ba5af2bb 100644 (file)
@@ -130,8 +130,8 @@ static void
 hiketech_trkpt_pr(const waypoint* waypointp)
 {
   gbfprintf(ofd, " <pnt>\n");
-  if (waypointp->creation_time) {
-    hiketech_print_utc(waypointp->GetCreationTime(), "  ", "utc");
+  if (waypointp->creation_time.isValid()) {
+    hiketech_print_utc(waypointp->GetCreationTime().toTime_t(), "  ", "utc");
   }
   gbfprintf(ofd, "  <lat>%f</lat>\n", waypointp->latitude);
   gbfprintf(ofd, "  <long>%f</long>\n", waypointp->longitude);
index 96fcf8af13a125ebafb566c1a3ccfb04a695bc0e..3572ae2936fbb768149d3a63387042334da0f341 100644 (file)
@@ -225,7 +225,7 @@ static void holux_disp(const waypoint* wpt)
   }
 
   /*set the time */
-  if (wpt->creation_time) {
+  if (wpt->creation_time.isValid()) {
     /* tm = gmtime(&wpt->creation_time);*/  /* I get the wrong result with gmtime ???  */
     QDate date(wpt->GetCreationTime().date());
     QTime time(wpt->GetCreationTime().time());
index 85583ee738420240cda0d365cdfd72348d534620..b3688367eda8a91aacef3c884884fa664f8e0415 100644 (file)
@@ -81,7 +81,7 @@ html_disp(const waypoint* wpt)
 {
   char tbuf[1024];
   char* cout;
-  time_t tm = wpt->GetCreationTime();
+  time_t tm = wpt->GetCreationTime().toTime_t();
   int32_t utmz;
   double utme, utmn;
   char utmzc;
@@ -187,7 +187,7 @@ html_disp(const waypoint* wpt)
 
       logpart = xml_findfirst(curlog, "groundspeak:date");
       if (logpart) {
-        logtime = xml_parse_time(logpart->cdata);
+        logtime = xml_parse_time(logpart->cdata).toTime_t();
         logtm = localtime(&logtime);
         if (logtm) {
           gbfprintf(file_out,
index 73b0785730a5700cdf3db8843b30fad4b81a757d..17f848d6ce074d1980bc03f50e41206ce81185a2 100644 (file)
@@ -716,7 +716,7 @@ humminbird_write_waypoint(const waypoint* wpt)
   hum.depth = si_round(WAYPT_GET(wpt, depth, 0)*100.0);
   be_write16(&hum.depth, hum.depth);
 
-  be_write32(&hum.time, wpt->GetCreationTime());
+  be_write32(&hum.time, wpt->GetCreationTime().toTime_t());
 
   east = wpt->longitude / 180.0 * EAST_SCALE;
   be_write32(&hum.east, si_round((east)));
@@ -817,7 +817,7 @@ humminbird_track_cb(const waypoint* wpt)
   north = si_round(inverse_gudermannian_i1924(lat));
 
   if (wpt->creation_time.isValid()) {
-    last_time = wpt->GetCreationTime();
+    last_time = wpt->GetCreationTime().toTime_t();
   }
 
   if (i == 0) {
index 52375aecff94c5d763d97f7f8b4979f19201300a..983f471b050656b4615fd6e86ea52275d6751e8b 100644 (file)
@@ -581,8 +581,8 @@ static void wr_header(void)
     track = pres_track;
   }
   // Date in header record is that of the first fix record
-  date = !track ? current_time() :
-         ((waypoint*) QUEUE_FIRST(&track->waypoint_list))->GetCreationTime();
+  date = !track ? current_time().toTime_t() :
+         ((waypoint*) QUEUE_FIRST(&track->waypoint_list))->GetCreationTime().toTime_t();
 
   if (NULL == (tm = gmtime(&date))) {
     fatal(MYNAME ": Bad track timestamp\n");
@@ -648,7 +648,7 @@ static void wr_task_hdr(const route_head* rte)
     fatal(MYNAME ": Too much waypoints (more than 99) in task route.\n");
   }
   // Gather data to write to the task identification (first) record
-  rte_time = wpt->GetCreationTime() ? wpt->GetCreationTime() : current_time();
+  rte_time = wpt->GetCreationTime().isValid() ? wpt->GetCreationTime().toTime_t() : current_time().toTime_t();
   if (NULL == (tm = gmtime(&rte_time))) {
     fatal(MYNAME ": Bad task route timestamp\n");
   }
@@ -692,7 +692,7 @@ static void wr_fix_record(const waypoint* wpt, int pres_alt, int gnss_alt)
 {
   struct tm* tm;
 
-  const time_t tt = wpt->GetCreationTime();
+  const time_t tt = wpt->GetCreationTime().toTime_t();
   tm = gmtime(&tt);
 
   if (NULL == tm) {
@@ -742,7 +742,7 @@ static int correlate_tracks(const route_head* pres_track, const route_head* gnss
       return 0;
     }
   } while (alt_diff > -10.0);
-  pres_time = ((waypoint*) elem->next)->GetCreationTime();
+  pres_time = ((waypoint*) elem->next)->GetCreationTime().toTime_t();
   if (global_opts.debug_level >= 1) {
     printf(MYNAME ": pressure landing time %s", ctime(&pres_time));
   }
@@ -758,7 +758,7 @@ static int correlate_tracks(const route_head* pres_track, const route_head* gnss
       return 0;
     }
     // Get a crude indication of groundspeed from the change in lat/lon
-    time_diff = wpt->GetCreationTime() - ((waypoint*) elem)->GetCreationTime();
+    time_diff = wpt->GetCreationTime().toTime_t() - ((waypoint*) elem)->GetCreationTime().toTime_t();
     speed = !time_diff ? 0 :
             (fabs(wpt->latitude - ((waypoint*) elem)->latitude) +
              fabs(wpt->longitude - ((waypoint*) elem)->longitude)) / time_diff;
@@ -766,7 +766,7 @@ static int correlate_tracks(const route_head* pres_track, const route_head* gnss
       printf(MYNAME ": speed=%f\n", speed);
     }
   } while (speed < 0.00003);
-  gnss_time = ((waypoint*) elem->next)->GetCreationTime();
+  gnss_time = ((waypoint*) elem->next)->GetCreationTime().toTime_t();
   if (global_opts.debug_level >= 1) {
     printf(MYNAME ": gnss landing time %s", ctime(&gnss_time));
   }
@@ -797,7 +797,7 @@ static double interpolate_alt(const route_head* track, time_t time)
     curr_elem = prev_elem = QUEUE_FIRST(&track->waypoint_list);
   }
   // Find the track points either side of the requested time
-  while (((waypoint*) curr_elem)->GetCreationTime() < time) {
+  while (((waypoint*) curr_elem)->GetCreationTime().toTime_t() < time) {
     if (QUEUE_LAST(&track->waypoint_list) == curr_elem) {
       // Requested time later than all track points, we can't interpolate
       return unknown_alt;
@@ -810,7 +810,7 @@ static double interpolate_alt(const route_head* track, time_t time)
   curr_wpt = (waypoint*) curr_elem;
 
   if (QUEUE_FIRST(&track->waypoint_list) == curr_elem) {
-    if (curr_wpt->GetCreationTime() == time) {
+    if (curr_wpt->GetCreationTime().toTime_t() == time) {
       // First point's creation time is an exact match so use it's altitude
       return curr_wpt->altitude;
     } else {
@@ -819,12 +819,12 @@ static double interpolate_alt(const route_head* track, time_t time)
     }
   }
   // Interpolate
-  if (0 == (time_diff = curr_wpt->GetCreationTime() - prev_wpt->GetCreationTime())) {
+  if (0 == (time_diff = curr_wpt->GetCreationTime().toTime_t() - prev_wpt->GetCreationTime().toTime_t())) {
     // Avoid divide by zero
     return curr_wpt->altitude;
   }
   alt_diff = curr_wpt->altitude - prev_wpt->altitude;
-  return prev_wpt->altitude + (alt_diff / time_diff) * (time - prev_wpt->GetCreationTime());
+  return prev_wpt->altitude + (alt_diff / time_diff) * (time - prev_wpt->GetCreationTime().toTime_t());
 }
 
 /*
@@ -861,7 +861,7 @@ static void wr_track(void)
     // Iterate through waypoints in both tracks simultaneously
     QUEUE_FOR_EACH(&gnss_track->waypoint_list, elem, tmp) {
       wpt = (waypoint*) elem;
-      pres_alt = interpolate_alt(pres_track, wpt->GetCreationTime() + time_adj);
+      pres_alt = interpolate_alt(pres_track, wpt->GetCreationTime().toTime_t() + time_adj);
       wr_fix_record(wpt, (int) pres_alt, (int) wpt->altitude);
     }
   } else {
index 62fbd15e16e8ce06599dc5085260934ab7748229..0e1b5a6b250ee5a63cb32b63dfbce1ca63714076 100644 (file)
@@ -263,7 +263,7 @@ ignr_write(void)
   }
   track_num = 0;
 
-  now = current_time();
+  now = current_time().toTime_t();
   tm = *localtime(&now);
 
   gbfprintf(fout, "<?xml version=\"1.0\" encoding=\"windows-1252\"?>\n");
index 228560d9ddeb959a59cbcc7b504a9d9195609fe4..4de57a4d4effe00f5da01ff9462a9b1c2cfd8c71 100644 (file)
@@ -217,7 +217,7 @@ static void write_igo8_track_point(const waypoint* wpt)
   // then we shall make our own, where each point is one
   // second apart.
   if (wpt->creation_time.isValid()) {
-    le_write32(&point.unix_time, wpt->GetCreationTime());
+    le_write32(&point.unix_time, wpt->GetCreationTime().toTime_t());
   } else {
     le_write32(&point.unix_time, invented_time++);
   }
index a660ca0c0dcc270a80856cf2d106c614d27853bf..caf380905d3328d932dfcd147e187a9539569b0f 100644 (file)
@@ -93,9 +93,9 @@ interpfilt_process(void)
         first = 0;
       } else {
         if (opt_interval &&
-            wpt->creation_time - time1 > interval) {
+            wpt->creation_time.toTime_t() - time1 > interval) {
           for (timen = time1+interval;
-               timen < wpt->creation_time;
+               timen < wpt->creation_time.toTime_t();
                timen += interval) {
             waypoint* wpt_new = waypt_dupe(wpt);
             wpt_new->creation_time = timen;
@@ -109,7 +109,7 @@ interpfilt_process(void)
             linepart(lat1, lon1,
                      wpt->latitude, wpt->longitude,
                      (double)(timen-time1)/
-                     (double)(wpt->creation_time-time1),
+                     (double)(wpt->creation_time.toTime_t() - time1),
                      &wpt_new->latitude,
                      &wpt_new->longitude);
             if (opt_route) {
@@ -131,7 +131,7 @@ interpfilt_process(void)
                  distn += dist) {
               waypoint* wpt_new = waypt_dupe(wpt);
               wpt_new->creation_time = distn/curdist*
-                                       (wpt->creation_time - time1) + time1;
+                                       (wpt->creation_time.toTime_t() - time1) + time1;
               if (wpt_new->shortname) {
                 xfree(wpt_new->shortname);
               }
@@ -161,7 +161,7 @@ interpfilt_process(void)
 
       lat1 = wpt->latitude;
       lon1 = wpt->longitude;
-      time1 = wpt->creation_time;
+      time1 = wpt->creation_time.toTime_t();
     }
   }
   route_flush(backuproute);
index c875a859b138a99add6156c8df195242642e6a7a..f5bd46111c46ccad6d94727d21c944d3e053fff8 100644 (file)
@@ -307,7 +307,7 @@ to_itracku_data_record(const waypoint* wp, itracku_data_record* d)
 {
   le_write32(d->longitude, deg_to_deg_min(wp->longitude));
   le_write32(d->latitude, deg_to_deg_min(wp->latitude));
-  le_write32(d->creation_time, encode_itracku_time(wp->creation_time));
+  le_write32(d->creation_time, encode_itracku_time(wp->creation_time.toTime_t()));
   d->speed = MPS_TO_KNOTS(wp->speed);
   le_write16(d->altitude, wp->altitude);
   d->flag = 0xff;
index 48ec3be4c4471c05e254d5d34068fdaa1cf6a6e0..9fb7a7e7fc147b20605cc9d5f48df6e8a73921ef 100644 (file)
@@ -272,7 +272,7 @@ jtr_trkpt_disp_cb(const waypoint* wpt)
   struct tm tm;
 
   if (wpt->creation_time.isValid()) {
-    const time_t tt = wpt->GetCreationTime();
+    const time_t tt = wpt->GetCreationTime().toTime_t();
     tm = *gmtime(&tt);
 
     tm.tm_year += 1900;
index f28e2a516bc423d19713adb616cda9ebab70b440..40d6ee0f41b42d48c2ac78214e36a635559806c5 100644 (file)
@@ -1930,7 +1930,7 @@ void kml_write(void)
 
   writer->writeStartElement("Document");
 
-  now = current_time();
+  now = current_time().toTime_t();
   strftime(import_time, sizeof(import_time), "%c", localtime(&now));
   if (realtime_positioning) {
     writer->writeTextElement("name", "GPS position");
@@ -2091,7 +2091,7 @@ kml_wr_position(waypoint* wpt)
     track_add_head(posn_trk_head);
   }
 
-  if (last_valid_fix == 0) {
+  if (!last_valid_fix.isValid()) {
     last_valid_fix = current_time();
   }
 
@@ -2117,7 +2117,7 @@ kml_wr_position(waypoint* wpt)
     last_valid_fix = wpt->GetCreationTime();
   }
 
-  wpt->icon_descr = kml_get_posn_icon(wpt->GetCreationTime() - last_valid_fix);
+  wpt->icon_descr = kml_get_posn_icon(wpt->GetCreationTime().toTime_t() - last_valid_fix.toTime_t());
 
 
   /* In order to avoid clutter while we're sitting still, don't add
index e1a15331cdecf2df90c98e187759b74a1502b767..c66f147202b654ec20c02222985c26203d93481b 100644 (file)
@@ -415,7 +415,7 @@ lowranceusr_parse_waypt(waypoint* wpt_tmp)
 
   if (global_opts.debug_level >= 2) {
     printf(MYNAME " parse_waypt: creation time %d\n",
-           (int)wpt_tmp->creation_time);
+           (int)wpt_tmp->creation_time.toTime_t());
     printf(MYNAME " parse_waypt: base_time %d\n", (int)base_time_secs);
     printf(MYNAME " parse_waypt: waypt time %d\n", (int)waypt_time);
   }
@@ -749,8 +749,8 @@ lowranceusr_waypt_disp(const waypoint* wpt)
     gbfputint32(text_len, file_out);
   }
 
-  if (wpt->creation_time > base_time_secs) {
-    Time = wpt->creation_time - base_time_secs;
+  if (wpt->creation_time.toTime_t() > base_time_secs) {
+    Time = wpt->creation_time.toTime_t() - base_time_secs;
   } else {
     Time = 0;
   }
@@ -758,7 +758,7 @@ lowranceusr_waypt_disp(const waypoint* wpt)
   if (global_opts.debug_level >= 2) {
     time_t wpt_time = Time;
     printf(MYNAME " waypt_disp: base_time : %d\n", (int)base_time_secs);
-    printf(MYNAME " waypt_disp: creation time : %d\n", (int)wpt->creation_time);
+    printf(MYNAME " waypt_disp: creation time : %d\n", (int)wpt->creation_time.toTime_t());
     printf(MYNAME " waypt_disp: waypt time : %d\n", (int)wpt_time);
     printf(MYNAME " waypt_disp: waypt time (local): %s\n", ctime(&wpt_time));
   }
index 8fd978177a1a82c672e66a3489ff125d0c8769df..4dc8f11847ee0e8bf64a269d1792c76dc4c15422 100644 (file)
@@ -810,8 +810,8 @@ lowranceusr4_waypt_disp(const waypoint* wpt)
   gbfputflt(WAYPT_GET(wpt, proximity, 0.0), file_out);
 
   /* Creation date/time */
-  gbfputint32(lowranceusr4_jd_from_timestamp(wpt->GetCreationTime()), file_out);
-  gbfputint32(wpt->GetCreationTime(), file_out);
+  gbfputint32(lowranceusr4_jd_from_timestamp(wpt->GetCreationTime().toTime_t()), file_out);
+  gbfputint32(wpt->GetCreationTime().toTime_t(), file_out);
 
   /* Unused byte */
   gbfputc(0, file_out);
@@ -982,7 +982,7 @@ lowranceusr4_write_track_waypt(const waypoint* wpt)
   gbfputc(0, file_out);
 
   /* Timestamp */
-  gbfputint32(wpt->GetCreationTime(), file_out);
+  gbfputint32(wpt->GetCreationTime().toTime_t(), file_out);
 
   /* Long/Lat */
   gbfputdbl(wpt->longitude * DEGREESTORADIANS, file_out);
index df2dabf8a09d6a599931ee80384f3596d507840b..e0ba75c5e8456133795c3e07ac5e31e08962ecd8 100644 (file)
@@ -142,12 +142,12 @@ my_writewpt(const waypoint* wpt)
   time_t tm_t;
   struct tm* tm;
   tm = NULL;
-  if (wpt->creation_time) {
-    const time_t tt = wpt->creation_time;
+  if (wpt->creation_time.isValid()) {
+    const time_t tt = wpt->creation_time.toTime_t();
     tm = gmtime(&tt);
   }
   if (!tm) {
-    tm_t = current_time();
+    tm_t = current_time().toTime_t();
     tm = gmtime(&tm_t);
   }
 
@@ -226,7 +226,7 @@ data_write(void)
 
   strncpy(file_out->name, "Companion Waypoints", PDB_DBNAMELEN);
   file_out->attr = PDB_FLAG_BACKUP;
-  file_out->ctime = file_out->mtime = current_time() + 2082844800U;
+  file_out->ctime = file_out->mtime = current_time().toTime_t() + 2082844800U;
   file_out->type = MYTYPE;  /* CWpt */
   file_out->creator = MYCREATOR; /* cGPS */
   file_out->version = 1;
index 2669fd75b4e96950b332f190bd5a8f8b256e82f3..454a8d7cfa4671a107aae139e9bb34d7f93b9ec8 100644 (file)
@@ -728,7 +728,7 @@ mag_serial_init_common(const char* portname)
     mag_handon();
   }
 
-  now = current_time();
+  now = current_time().toTime_t();
   /*
    * The 315 can take up to 4.25 seconds to respond to initialization
    * commands.   Time out on the side of caution.
@@ -739,7 +739,7 @@ mag_serial_init_common(const char* portname)
 
   while (!got_version) {
     mag_readmsg(trkdata);
-    if (current_time() > later) {
+    if (current_time().toTime_t() > later) {
       fatal(MYNAME ": No acknowledgment from GPS on %s\n",
             portname);
     }
@@ -1441,8 +1441,8 @@ void mag_track_disp(const waypoint* waypointp)
   ilat = waypointp->latitude;
   ilon = waypointp->longitude;
   tm = NULL;
-  if (waypointp->creation_time) {
-    const time_t ct = waypointp->GetCreationTime();
+  if (waypointp->creation_time.isValid()) {
+    const time_t ct = waypointp->GetCreationTime().toTime_t();
     tm = gmtime(&ct);
     if (tm) {
       hms = tm->tm_hour * 10000 + tm->tm_min  * 100 +
index bdd8862c912c41efdd54564f212a2f1bba9c1d72..938fd1b75c7bd2c79ff49c39edd4f477a6c7d847 100644 (file)
@@ -254,7 +254,7 @@ main(int argc, char* argv[])
   global_opts.inifile = NULL;
 
   gpsbabel_now = time(NULL);                   /* gpsbabel startup-time */
-  gpsbabel_time = current_time();                      /* same like gpsbabel_now, but freezed to zero during testo */
+  gpsbabel_time = current_time().toTime_t();                   /* same like gpsbabel_now, but freezed to zero during testo */
 
 #ifdef DEBUG_MEM
   debug_mem_open();
index 893697deae24ffb2b08fef26c38fc441672dcb9e..f4259ac9d11d5dd06b73d581efaa764be29b3cb2 100644 (file)
@@ -133,7 +133,7 @@ tr7_read(void)
     }
 
     if (prev) {        /* other track or bad timestamp */
-      if (wpt->creation_time && (prev->creation_time > wpt->creation_time)) {
+      if (wpt->creation_time.isValid() && (prev->creation_time.toTime_t() > wpt->creation_time.toTime_t())) {
         trk = NULL;
       } else if (waypt_distance(prev, wpt) > 9999.9) {
         trk = NULL;
index 0831b1a5f8f9df59fd607e68fc91e34111bd0e82..e74739bf63b40baa16b3dd650f241fe2c55ef6c4 100644 (file)
@@ -50,7 +50,7 @@ mapbar_track_rd_deinit(void)
 }
 
 static gpsbabel::DateTime
-read_time_t(void)
+read_datetime(void)
 {
   int hour = gbfgetint16(fin);
   int min = gbfgetint16(fin);
@@ -85,10 +85,8 @@ mapbar_track_read(void)
   is_fatal((track == NULL), MYNAME ": memory non-enough");
   track_add_head(track);
 
-  time_t start_time = read_time_t();
-  (void) start_time; // currently not used.
-  time_t end_time = read_time_t();
-  (void) end_time; // currently not used.
+  (void) read_datetime(); // start_time currently unused
+  (void) read_datetime(); // end_time currently unused
 
   char name[200] = {0};
   gbfread((void*)name, 1, 200, fin);
index 26bc5333bce450d870701066cd5ddf7e7b35afe2..6aeb6c50e3a752df4d76623fa0fe1804fdb55545 100644 (file)
@@ -486,7 +486,7 @@ void mapsend_track_disp(const waypoint* wpt)
    *
    * This is rumoured (but yet unconfirmed) to be fixed in f/w 5.12.
    */
-  t = wpt->GetCreationTime();
+  t = wpt->GetCreationTime().toTime_t();
   if (t < last_time)  {
     t = last_time;
   }
index 3d10c591ae7e0bf13c50974f1e2abc322747647f..60702429521ef4e2b0c4c758560b9fdce903daaa 100644 (file)
@@ -258,7 +258,7 @@ mps_wr_init(const char* fname)
       mpsmergeout = 0;
     } else {
       gbfclose(mps_file_out);
-      srand((unsigned) current_time());
+      srand((unsigned) current_time().toTime_t());
 
       for (;;) {
         /* create a temporary name  based on a random char and the existing name */
@@ -1148,7 +1148,7 @@ mps_routehdr_w(gbfile* mps_file, int mps_ver, const route_head* rte)
     QUEUE_FOR_EACH(&rte->waypoint_list, elem, tmp) {
       testwpt = (waypoint*)elem;
       if (rte_datapoints == 0) {
-        uniqueValue = testwpt->GetCreationTime();
+        uniqueValue = testwpt->GetCreationTime().toTime_t();
       }
       if (testwpt->latitude > maxlat) {
         maxlat = testwpt->latitude;
@@ -1188,7 +1188,7 @@ mps_routehdr_w(gbfile* mps_file, int mps_ver, const route_head* rte)
     }
 
     if (uniqueValue == 0) {
-      uniqueValue = current_time();
+      uniqueValue = current_time().toTime_t();
     }
 
     /* route name */
@@ -1581,13 +1581,13 @@ mps_trackhdr_w(gbfile* mps_file, int mps_ver, const route_head* trk)
     QUEUE_FOR_EACH(&trk->waypoint_list, elem, tmp) {
       if (trk_datapoints == 0) {
         testwpt = (waypoint*)elem;
-        uniqueValue = testwpt->GetCreationTime();
+        uniqueValue = testwpt->GetCreationTime().toTime_t();
       }
       trk_datapoints++;
     }
 
     if (uniqueValue == 0) {
-      uniqueValue = current_time();
+      uniqueValue = current_time().toTime_t();
     }
 
     /* track name */
@@ -1636,7 +1636,7 @@ static void
 mps_trackdatapoint_w(gbfile* mps_file, int mps_ver, const waypoint* wpt)
 {
   int lat, lon;
-  time_t       t = wpt->GetCreationTime();
+  time_t       t = wpt->GetCreationTime().toTime_t();
   char zbuf[10];
 
   double       mps_altitude = wpt->altitude;
index a05126a11d3e67af36453bbd545cb4b26cdd1cea..390039f69bbb4e1fec5f2130e5c4e66fa99a919f 100644 (file)
@@ -894,11 +894,11 @@ nmea_fix_timestamps(route_head* track)
 
         dt = (prev / SECONDS_PER_DAY) * SECONDS_PER_DAY;
         wpt->creation_time += dt;
-        if (wpt->creation_time > prev) {
+        if (wpt->creation_time.toTime_t() > prev) {
           wpt->creation_time+=SECONDS_PER_DAY;
         }
       }
-      prev = wpt->GetCreationTime();
+      prev = wpt->GetCreationTime().toTime_t();
     }
   }
 }
@@ -1260,19 +1260,19 @@ nmea_trackpt_pr(const waypoint* wpt)
       if (sleepus >= 0) {
         gb_sleep(sleepus);
       } else {
-        long wait_time = wpt->GetCreationTime() - last_time;
+        long wait_time = wpt->GetCreationTime().toTime_t() - last_time;
         if (wait_time > 0) {
           gb_sleep(wait_time * 1000000);
         }
       }
     }
-    last_time = wpt->GetCreationTime();
+    last_time = wpt->GetCreationTime().toTime_t();
   }
 
   lat = degrees2ddmm(wpt->latitude);
   lon = degrees2ddmm(wpt->longitude);
 
-  time_t ct = wpt->GetCreationTime();
+  time_t ct = wpt->GetCreationTime().toTime_t();
   tm = gmtime(&ct);
   if (tm) {
     hms = tm->tm_hour * 10000 + tm->tm_min * 100 + tm->tm_sec;
index a75782325a0e7b8e4bbe25dcb752b0e55596f019..292f8b2ccef43ab9027fbc06b70d9cbc2c73a840 100644 (file)
@@ -803,7 +803,7 @@ osm_waypt_disp(const waypoint* wpt)
   ((waypoint*)(wpt))->extra_data = id;
 
   gbfprintf(fout, "  <node id='%d' visible='true' lat='%0.7f' lon='%0.7f'", *id, wpt->latitude, wpt->longitude);
-  if (wpt->creation_time) {
+  if (wpt->creation_time.isValid()) {
     QString time_string = wpt->CreationTimeXML();
     gbfprintf(fout, " timestamp='%s'", qPrintable(time_string));
   }
index 81a5a31bcc8c5d4c8ab9750ef1e7e6e2f568e9fe..5f670dd2e1479e226656c49ef7d97df6903446a8 100644 (file)
@@ -150,7 +150,7 @@ ozi_alloc_fsdata(void)
 void
 ozi_get_time_str(const waypoint *waypointp, char *buff, gbsize_t buffsz)
 {
-  if (waypointp->creation_time) {
+  if (waypointp->creation_time.isValid()) {
     double time = (waypt_time(waypointp) / SECONDS_PER_DAY) + DAYS_SINCE_1990;
     snprintf(buff, buffsz, "%.7f", time);
   } else {
index 12eb40aff3d87b839e4ac1713347955213f7470b..a136ff83925b7b7aeec44628bd055584bbcc49ad 100644 (file)
@@ -405,7 +405,7 @@ palmdoc_disp(const waypoint *wpt)
 {
   int latint, lonint;
   char tbuf[1024];
-  time_t tm = wpt->GetCreationTime();
+  time_t tm = wpt->GetCreationTime().toTime_t();
   int32 utmz;
   double utme, utmn;
   char utmzc;
@@ -507,7 +507,7 @@ palmdoc_disp(const waypoint *wpt)
 
       logpart = xml_findfirst(curlog, "groundspeak:date");
       if (logpart) {
-        logtime = xml_parse_time(logpart->cdata);
+        logtime = xml_parse_time(logpart->cdata).toTime_t();
         logtm = localtime(&logtime);
         if (logtm) {
           docprintf(15,
@@ -584,7 +584,7 @@ data_write(void)
   }
   file_out->name[PDB_DBNAMELEN-1] = 0;
   file_out->attr = PDB_FLAG_BACKUP;
-  file_out->ctime = file_out->mtime = current_time() + 2082844800U;
+  file_out->ctime = file_out->mtime = current_time().toTime_t() + 2082844800U;
   file_out->type = DOC_TYPE;
   file_out->creator = DOC_CREATOR;
   file_out->version = 1;
index 16a08ecac54c53c9d1d2902cb5766422fccf0add..3f11064bd4d71354e852546491ac66837a8d5c5c 100644 (file)
@@ -377,7 +377,7 @@ int ppdb_decode_tm(char *str, struct tm *tm)
     struct tm now;
 
 
-    tnow = current_time();
+    tnow = current_time().toTime_t();
     now = *localtime(&tnow);
     now.tm_year += 1900;
     now.tm_mon++;
@@ -748,7 +748,7 @@ static void ppdb_write(void)
   }
 
   file_out->attr = PDB_FLAG_BACKUP;
-  file_out->ctime = file_out->mtime = current_time() + 2082844800U;
+  file_out->ctime = file_out->mtime = current_time().toTime_t() + 2082844800U;
   file_out->creator = PPDB_MAGIC;
   file_out->version = 3;
 
index b4a463d4bf1825bad5f2e1a3972ab6a468b57787..7dbcaf319fbc110545fcbfd979c1731c1ab07f1e 100644 (file)
@@ -321,13 +321,13 @@ gpsutil_disp(const waypoint *wpt)
   double lon,lat;
   int icon_token = 0;
   char tbuf[1024];
-  time_t tm = wpt->GetCreationTime();
+  time_t tm = wpt->GetCreationTime().toTime_t();
 
   lon = degrees2ddmm(wpt->longitude);
   lat = degrees2ddmm(wpt->latitude);
 
   if (tm == 0) {
-    tm = current_time();
+    tm = current_time().toTime_t();
   }
   strftime(tbuf, sizeof(tbuf), "%d-%b-%y %I:%M:%S", localtime(&tm));
   strupper(tbuf);
@@ -407,7 +407,7 @@ pcx_track_disp(const waypoint *wpt)
   lon = degrees2ddmm(wpt->longitude);
   lat = degrees2ddmm(wpt->latitude);
 
-  const time_t ct = wpt->GetCreationTime();
+  const time_t ct = wpt->GetCreationTime().toTime_t();
   tm = gmtime(&ct);
 
   strftime(tbuf, sizeof(tbuf), "%d-%b-%y %H:%M:%S", tm);       /* currently ...%T does nothing under Windows */
index 7d46ea542507f2f2a08803037981f55b70eab184..c43b32d113ea443df7918b6f8d8dee578969436d 100644 (file)
@@ -134,8 +134,8 @@ pocketfms_waypt_disp(const waypoint *wpt)
   memset(&bc, 0, sizeof(bc));
   const time_t tt = wpt->GetCreationTime().toTime_t();
   tm = localtime(&tt);
-  if (wpt->creation_time) {
-    const time_t tt = wpt->GetCreationTime();
+  if (wpt->creation_time.isValid()) {
+    const time_t tt = wpt->GetCreationTime().toTime_t();
     tm = gmtime(&tt);
   }
 
index 87bb178872022a1369519f917991f79edb719f1b..4eaff93126067dc893dfe5be276adf55af3bb226 100644 (file)
@@ -488,13 +488,13 @@ psit_routehdr_w(gbfile *psit_file, const route_head *rte)
     QUEUE_FOR_EACH(&rte->waypoint_list, elem, tmp) {
       testwpt = (waypoint *)elem;
       if (rte_datapoints == 0) {
-        uniqueValue = testwpt->GetCreationTime();
+        uniqueValue = testwpt->GetCreationTime().toTime_t();
       }
       rte_datapoints++;
     }
 
     if (uniqueValue == 0) {
-      uniqueValue = current_time();
+      uniqueValue = current_time().toTime_t();
     }
 
     /* route name */
@@ -648,13 +648,13 @@ psit_trackhdr_w(gbfile *psit_file, const route_head *trk)
       QUEUE_FOR_EACH(&trk->waypoint_list, elem, tmp) {
         if (trk_datapoints == 0) {
           testwpt = (waypoint *)elem;
-          uniqueValue = testwpt->GetCreationTime();
+          uniqueValue = testwpt->GetCreationTime().toTime_t();
         }
         trk_datapoints++;
       }
 
       if (uniqueValue == 0) {
-        uniqueValue = current_time();
+        uniqueValue = current_time().toTime_t();
       }
 
       /* track name */
@@ -692,7 +692,7 @@ psit_trackhdr_w_wrapper(const route_head *trk)
 static void
 psit_trackdatapoint_w(gbfile *psit_file, const waypoint *wpt)
 {
-  time_t       t = wpt->GetCreationTime();
+  time_t       t = wpt->GetCreationTime().toTime_t();
   struct tm *tmTime = gmtime(&t);
 
   gbfprintf(psit_file, "%11.6f,%11.6f,",
index 7e286129c32497e384b17e9a969c9d6961a47d7f..7a2cd2f13908a743495f51e98b458225fed1e1e3 100644 (file)
@@ -219,7 +219,7 @@ data_write(void)
   }
   file_out->name[PDB_DBNAMELEN-1] = 0;
   file_out->attr = PDB_FLAG_BACKUP;
-  file_out->ctime = file_out->mtime = current_time() + 2082844800U;
+  file_out->ctime = file_out->mtime = current_time().toTime_t() + 2082844800U;
   file_out->type = MYTYPE;  /* CWpt */
   file_out->creator = MYCREATOR; /* cGPS */
   file_out->version = 1;
index 8303976794bcac43d7cc8d889b3a60a4196b3629..d0e3186b7d4fe5f6ccec7a0367a6916a1873c9ed 100644 (file)
@@ -349,7 +349,7 @@ write_waypoint(gbfile *fout, const waypoint *wpt, const int waypt_no, const char
     }
   }
   notes = csv_stringclean(notes, LINE_FEED);
-  time = (wpt->creation_time > 0) ? TIMET_TO_EXCEL(wpt->GetCreationTime()) : TIMET_TO_EXCEL(gpsbabel_time);
+  time = wpt->creation_time.isValid() ? TIMET_TO_EXCEL(wpt->GetCreationTime().toTime_t()) : TIMET_TO_EXCEL(gpsbabel_time);
   name = (char *)wpt->extra_data;
 
   gbfprintf(fout, "[Wp%d]" LINE_FEED
index 1e5b7e7bfbe3e5674efec8dbbe9fba647adfff3d..6f2c735ff2e6cd10a22aa6bafad1bbe1937c41e6 100644 (file)
@@ -655,12 +655,12 @@ void track_recompute(const route_head *trk, computed_trkdata **trkdatap)
       tdata->max_cad = (int) thisw->cadence;
     }
 
-    if (thisw->GetCreationTime() && (thisw->GetCreationTime() < tdata->start)) {
-      tdata->start = thisw->GetCreationTime();
+    if (thisw->GetCreationTime().isValid() && (thisw->GetCreationTime().toTime_t() < tdata->start)) {
+      tdata->start = thisw->GetCreationTime().toTime_t();
     }
 
-    if (thisw->creation_time > tdata->end) {
-      tdata->end = thisw->GetCreationTime();
+    if (thisw->creation_time.toTime_t() > tdata->end) {
+      tdata->end = thisw->GetCreationTime().toTime_t();
       if (tdata->start == 0) {
         tdata->start = tdata->end;
       }
index a78332233e44754d7acceb07b14ace09fde166d5..0281ec99d92903d3974ff27404997f13823871ad 100644 (file)
@@ -177,7 +177,7 @@ skyforce_waypt_disp_cb(const waypoint *wpt)
   if (global_opts.objective == trkdata) {
     struct tm tm;
 
-    const time_t tt = wpt->GetCreationTime();
+    const time_t tt = wpt->GetCreationTime().toTime_t();
     tm = *gmtime(&tt);
     strftime(buf + 2, sizeof(buf) - 2, "%d%m%y  %H%M%S    ", &tm);
   } else {
index 2ff7a010c25d048371f3da855f0281708c834a9c..9b25d336f01aa73c573600cdf00ef906e37a17db 100644 (file)
@@ -187,8 +187,8 @@ compute_xte(struct xte *xte_rec)
     }
     // if timestamps exist, distance to interpolated point
     if (wpt1->GetCreationTime() != wpt2->GetCreationTime()) {
-      frac = (double)(wpt3->GetCreationTime() - wpt1->GetCreationTime()) /
-             (wpt2->GetCreationTime() - wpt1->GetCreationTime());
+      frac = (double)(wpt3->GetCreationTime().toTime_t() - wpt1->GetCreationTime().toTime_t()) /
+             (wpt2->GetCreationTime().toTime_t() - wpt1->GetCreationTime().toTime_t());
       linepart(wpt1->latitude, wpt1->longitude,
                wpt2->latitude, wpt2->longitude,
                frac, &reslat, &reslon);
index d13c67da7fcf3a8239032d7ce15d9d25ec291cce..dec8a74cd08a28c30f124bd33617616d8794e785 100644 (file)
@@ -70,7 +70,7 @@ sort_comp(const queue * a, const queue * b)
   case sm_description:
     return strcmp(x1->description, x2->description);
   case sm_time:
-    return x1->GetCreationTime() - x2->GetCreationTime();
+    return x1->GetCreationTime().toTime_t() - x2->GetCreationTime().toTime_t();
   default:
     abort();
     return 0; /* Internal caller error. */
index 261f184109d0d70c3058471138a4072b8b061c61..4f08a88f44242b3f1be6e408541864445200ce08 100644 (file)
@@ -45,9 +45,6 @@ public:
   DateTime(QDate date, QTime time) : QDateTime(date, time) {}
   DateTime(QDateTime dt) : QDateTime(dt) {}
 
-  // Handle time_tm tm = wpt->creation_time;
-  operator time_t() const { return toTime_t(); }
-
   const time_t& operator=(const time_t& t) {
     setTime_t(t);
     return t;
@@ -58,6 +55,14 @@ public:
     return toTime_t();
   }
 
+  DateTime operator+(quint64 seconds) {
+    return DateTime::fromMSecsSinceEpoch(toMSecsSinceEpoch() + seconds*1000);
+  }
+
+  DateTime operator-(quint64 seconds) {
+    return DateTime::fromMSecsSinceEpoch(toMSecsSinceEpoch() - seconds*1000);
+  }
+
   // Integer form: YYMMDD
   int ymd() const {
     QDate d(date());
index 70f34858df1d9b553c38bf24a2f190aca8177955..d5a14dcae891f1a509cee2edd018ca6fd4d30d05 100644 (file)
@@ -169,7 +169,7 @@ track_qsort_cb(const void *a, const void *b)
   const waypoint *wa = *(waypoint **)a;
   const waypoint *wb = *(waypoint **)b;
 
-  return wa->GetCreationTime() - wb->GetCreationTime();
+  return wa->GetCreationTime().toTime_t() - wb->GetCreationTime().toTime_t();
 }
 
 static void
@@ -455,7 +455,7 @@ calculate(const waypoint *wpt, double *dist, double *speed, double *course,
       *dist = 0;  /* calc. diffs on 32- and 64-bit hosts */
     }
 
-    time = wpt->creation_time - trkpt_out->GetCreationTime();
+    time = wpt->creation_time.toTime_t() - trkpt_out->GetCreationTime().toTime_t();
     if (time == 0) {
       *speed = 0;
     } else {
@@ -526,7 +526,7 @@ any_waypt_calc_cb(const waypoint *wpt)
   }
 
   if ((all_points == 0) && (this_points == 0)) {
-    start_time = wpt->GetCreationTime();
+    start_time = wpt->GetCreationTime().toTime_t();
   }
 
   this_points++;
@@ -544,7 +544,7 @@ any_waypt_calc_cb(const waypoint *wpt)
 
   this_distance = this_distance + dist;
   if (trkpt_out != NULL) {
-    this_time += (wpt->GetCreationTime() - trkpt_out->GetCreationTime());
+    this_time += (wpt->GetCreationTime().toTime_t() - trkpt_out->GetCreationTime().toTime_t());
   }
 
   trkpt_out = (waypoint *)wpt;
@@ -585,7 +585,7 @@ track_disp_wpt_cb(const waypoint *wpt)
   track_points++;
   all_track_points++;
 
-  time_t ct = wpt->GetCreationTime();
+  time_t ct = wpt->GetCreationTime().toTime_t();
   tm = *localtime(&ct);
   strftime(tbuf, sizeof(tbuf), "%d.%m.%Y,%H:%M.%S", &tm);
 
@@ -669,8 +669,8 @@ route_disp_wpt_cb(const waypoint *wpt)
 static void
 track_disp_custom_cb(const waypoint *wpt)
 {
-  if (wpt->GetCreationTime() && (wpt->altitude != unknown_alt)) {
-    gbfprintf(fout, "%d,%.f\n", (int)(wpt->GetCreationTime() - start_time), wpt->altitude);
+  if (wpt->GetCreationTime().isValid() && (wpt->altitude != unknown_alt)) {
+    gbfprintf(fout, "%d,%.f\n", (int)(wpt->GetCreationTime().toTime_t() - start_time), wpt->altitude);
   }
 }
 
index 9d3e42c7eb0186a8748cd66a202ca29d5a9eefd3..ca42b9c2fa84a6c6686a0445f28a0a43338bbe4d 100644 (file)
@@ -238,7 +238,7 @@ stmwpp_waypt_cb(const waypoint *wpt)
     return;
   }
 
-  const time_t tt = wpt->GetCreationTime();
+  const time_t tt = wpt->GetCreationTime().toTime_t();
   tm = *gmtime(&tt);
   tm.tm_year += 1900;
   tm.tm_mon++;
index dd48e2caf7d49cf81cbf040d253c3be3bef3b9f3..a4bf563e23f39239800a95d9640800662e2ecd0e 100644 (file)
@@ -92,17 +92,17 @@ subrip_prevwp_pr(const waypoint *waypointp)
   time_t starttime;
   time_t endtime;
 
-  if (prevwpp->GetCreationTime() >= time_offset)
+  if (prevwpp->GetCreationTime().toTime_t() >= time_offset)
     /* if this condition is not true, the waypoint is before the beginning of
      * the video and will be ignored
      */
   {
 
-    starttime = gps_to_video_time(prevwpp->GetCreationTime());
+    starttime = gps_to_video_time(prevwpp->GetCreationTime().toTime_t());
     if (!waypointp) {
       endtime = starttime + 1;
     } else {
-      endtime = gps_to_video_time(waypointp->GetCreationTime());
+      endtime = gps_to_video_time(waypointp->GetCreationTime().toTime_t());
     }
     gbfprintf(fout, "%d\n", stnum);
     stnum++;
@@ -120,7 +120,7 @@ subrip_prevwp_pr(const waypoint *waypointp)
     } else if WAYPT_HAS(prevwpp, speed) {
       gbfprintf(fout, "\n");
     }
-    subrip_write_time(prevwpp->GetCreationTime());
+    subrip_write_time(prevwpp->GetCreationTime().toTime_t());
     gbfprintf(fout, " Lat=%0.5lf Lon=%0.5lf\n",
               prevwpp->latitude + .000005,
               prevwpp->longitude + .000005);
@@ -148,7 +148,7 @@ subrip_trkpt_pr(const waypoint *waypointp)
      * way of solving this should be trivial to you :-)
      */
   {
-    time_offset = sync_time(waypointp->GetCreationTime(), opt_videotime);
+    time_offset = sync_time(waypointp->GetCreationTime().toTime_t(), opt_videotime);
   }
 
   if (prevwpp) {
index 28d47d47bb5eb20828f06c0d877aa171ca6e05fa..a1bacc4e102e9b2f8cf85a2de9147a7244e3a687 100644 (file)
@@ -97,7 +97,7 @@ text_disp(const waypoint *wpt)
 {
   int latint, lonint;
   char tbuf[1024];
-  time_t tm = wpt->GetCreationTime();
+  time_t tm = wpt->GetCreationTime().toTime_t();
   int32_t utmz;
   double utme, utmn;
   char utmzc;
@@ -203,7 +203,7 @@ text_disp(const waypoint *wpt)
 
       logpart = xml_findfirst(curlog, "groundspeak:date");
       if (logpart) {
-        logtime = xml_parse_time(logpart->cdata);
+        logtime = xml_parse_time(logpart->cdata).toTime_t();
         logtm = localtime(&logtime);
         if (logtm) {
           gbfprintf(file_out,
index bfcf147a71e9265c9a80cab1dfece55f11337c82..89074a5394a7829c8510d006508fd7ccc03ee3ff 100644 (file)
@@ -354,8 +354,8 @@ trackfilter_fill_track_list_cb(const route_head *track)     /* callback for track_d
     track_pts++;
 
     wpt = (waypoint *)elem;
-    if(wpt->creation_time == 0) timeless_pts++;
-    if (!(opt_merge && opt_discard) && (need_time != 0) && (wpt->creation_time == 0)) {
+    if (!wpt->creation_time.isValid()) timeless_pts++;
+    if (!(opt_merge && opt_discard) && (need_time != 0) && (!wpt->creation_time.isValid())) {
       fatal(MYNAME "-init: Found track point at %f,%f without time!\n",
             wpt->latitude, wpt->longitude);
     }
@@ -525,7 +525,7 @@ trackfilter_merge(void)
     route_head *track = track_list[i].track;
     QUEUE_FOR_EACH((queue *)&track->waypoint_list, elem, tmp) {
       wpt = (waypoint *)elem;
-      if(wpt->creation_time != 0) {
+      if(wpt->creation_time.isValid()) {
         buff[j++] = waypt_dupe(wpt);
       }
       track_del_wpt(track, wpt);
@@ -730,7 +730,7 @@ trackfilter_split(void)
       }
 
       if (interval > 0) {
-        double tr_interval = difftime(buff[j]->GetCreationTime(),buff[i]->GetCreationTime());
+        double tr_interval = difftime(buff[j]->GetCreationTime().toTime_t(), buff[i]->GetCreationTime().toTime_t());
         if (tr_interval <= interval) {
           new_track_flag = 0;
         }
@@ -835,12 +835,12 @@ trackfilter_synth(void)
                     RAD(wpt->longitude)));
         }
         if (opt_speed) {
-          if (oldtime != wpt->GetCreationTime()) {
+          if (oldtime != wpt->GetCreationTime().toTime_t()) {
             WAYPT_SET(wpt, speed, radtometers(gcdist(
                                                 RAD(oldlat), RAD(oldlon),
                                                 RAD(wpt->latitude),
                                                 RAD(wpt->longitude))) /
-                      labs(wpt->GetCreationTime()-oldtime));
+                      labs(wpt->GetCreationTime().toTime_t()-oldtime));
           } else {
             WAYPT_UNSET(wpt, speed);
           }
@@ -848,7 +848,7 @@ trackfilter_synth(void)
       }
       oldlat = wpt->latitude;
       oldlon = wpt->longitude;
-      oldtime = wpt->GetCreationTime();
+      oldtime = wpt->GetCreationTime().toTime_t();
     }
   }
 }
@@ -915,12 +915,12 @@ trackfilter_range(void)           /* returns number of track points left after filtering
 
     QUEUE_FOR_EACH((queue *)&track->waypoint_list, elem, tmp) {
       waypoint *wpt = (waypoint *)elem;
-      if (wpt->creation_time > 0) {
-        inside = ((wpt->GetCreationTime() >= start) && (wpt->GetCreationTime() <= stop));
+      if (wpt->creation_time.isValid()) {
+        inside = ((wpt->GetCreationTime().toTime_t() >= start) && (wpt->GetCreationTime().toTime_t() <= stop));
       }
       // If the time is mangled so horribly that it's
       // negative, toss it.
-      if (wpt->creation_time < 0) {
+      if (!wpt->creation_time.isValid()) {
         inside = 0;
       }
 
@@ -1118,7 +1118,7 @@ trackfilter_faketime(void)             /* returns number of track points left af
     QUEUE_FOR_EACH((queue *)&track->waypoint_list, elem, tmp) {
       waypoint *wpt = (waypoint *)elem;
 
-      if (opt_faketime != 0 && (wpt->creation_time == 0 || faketime.force)) {
+      if (opt_faketime != 0 && (!wpt->creation_time.isValid() || faketime.force)) {
         wpt->creation_time = QDateTime::fromTime_t(faketime.start);
         faketime.start += faketime.step;
       }
index 4ae326bef02622b35f3ddc2629a2633490e51139..779e44e6c385d7906616a64ba692eda4a1bbd98e 100644 (file)
@@ -1373,7 +1373,7 @@ unicsv_waypt_enum_cb(const waypoint *wpt)
   }
   if (wpt->creation_time.isValid()) {
     gb_setbit(&unicsv_outp_flags, fld_time);
-    if (wpt->creation_time >= SECONDS_PER_DAY) {
+    if (wpt->creation_time.toTime_t() >= SECONDS_PER_DAY) {
       gb_setbit(&unicsv_outp_flags, fld_date);
     }
   }
@@ -1478,10 +1478,10 @@ unicsv_waypt_enum_cb(const waypoint *wpt)
     if (gc_data->is_available) {
       gb_setbit(&unicsv_outp_flags, fld_gc_is_available);
     }
-    if (gc_data->exported) {
+    if (gc_data->exported.isValid()) {
       gb_setbit(&unicsv_outp_flags, fld_gc_exported);
     }
-    if (gc_data->last_found) {
+    if (gc_data->last_found.isValid()) {
       gb_setbit(&unicsv_outp_flags, fld_gc_last_found);
     }
     if (!gc_data->placer.isEmpty()) {
@@ -1729,16 +1729,16 @@ unicsv_waypt_disp_cb(const waypoint *wpt)
     }
   }
   if FIELD_USED(fld_date) {
-    if (wpt->creation_time >= SECONDS_PER_DAY) {
+    if (wpt->creation_time.toTime_t() >= SECONDS_PER_DAY) {
       struct tm tm;
       char buf[32];
-      time_t time = wpt->GetCreationTime();
+      time_t time = wpt->GetCreationTime().toTime_t();
 
       if (opt_utc) {
         time += atoi(opt_utc) * SECONDS_PER_HOUR;
         tm = *gmtime(&time);
       } else {
-        const time_t tt = wpt->GetCreationTime();
+        const time_t tt = wpt->GetCreationTime().toTime_t();
         tm = *localtime(&tt);
       }
       tm.tm_year += 1900;
@@ -1750,16 +1750,16 @@ unicsv_waypt_disp_cb(const waypoint *wpt)
     }
   }
   if FIELD_USED(fld_time) {
-    if (wpt->creation_time != 0) {
+    if (wpt->creation_time.isValid()) {
       struct tm tm;
       char buf[32], msec[12];
-      time_t time = wpt->GetCreationTime();
+      time_t time = wpt->GetCreationTime().toTime_t();
 
       if (opt_utc) {
         time += atoi(opt_utc) * SECONDS_PER_HOUR;
         tm = *gmtime(&time);
       } else {
-        const time_t tt = wpt->GetCreationTime();
+        const time_t tt = wpt->GetCreationTime().toTime_t();
         tm = *localtime(&tt);
       }
       snprintf(buf, sizeof(buf), "%02d:%02d:%02d", tm.tm_hour, tm.tm_min, tm.tm_sec);
@@ -1875,14 +1875,14 @@ unicsv_waypt_disp_cb(const waypoint *wpt)
   }
   if FIELD_USED(fld_gc_exported) {
     if (gc_data) {
-      unicsv_print_data_time(gc_data->exported);
+      unicsv_print_data_time(gc_data->exported.toTime_t());
     } else {
       gbfputs(unicsv_fieldsep, fout);
     }
   }
   if FIELD_USED(fld_gc_last_found) {
     if (gc_data) {
-      unicsv_print_data_time(gc_data->last_found);
+      unicsv_print_data_time(gc_data->last_found.toTime_t());
     } else {
       gbfputs(unicsv_fieldsep, fout);
     }
index ba890d9a2ab25b478b4790974425203fc15b0de3..1556331fc1f967c945a0a4d2286ca066c9b04c3a 100644 (file)
@@ -324,7 +324,7 @@ vitosmt_write(void)
 
   workbuffer = (unsigned char*) xcalloc(vitosmt_headersize,1);
 
-  now = current_time();
+  now = current_time().toTime_t();
   count = 0;
   position = 0;
 
index a990b8a5fdc1ee87bfaf3af0cf2976dc6fc284f4..45fd0fa75c43c6ae6c22bfe702380f8f86b1157e 100644 (file)
@@ -542,11 +542,10 @@ gcgeodist(const double lat1, const double lon1,
 double
 waypt_time(const waypoint *wpt)
 {
-  if (wpt->creation_time <= 0) {
+  if (!wpt->creation_time.isValid()) {
     return (double) 0;
   } else {
-
-    return ((double)wpt->creation_time + ((double)wpt->creation_time.time().msec() / 1000));
+    return ((double)wpt->creation_time.toMSecsSinceEpoch()) / 1000.0;
   }
 }
 
index 9e9330578f26b4d1d142730c52883a70e46e4cd3..52043b12d90af0acd8da11d59810eb2077869368 100644 (file)
@@ -176,7 +176,7 @@ void wfff_chan(const char *args, const QXmlStreamAttributes* unused)
 void wfff_first(const char *args, const QXmlStreamAttributes* unused)
 {
   if (args) {
-    ap_first = xml_parse_time(args);
+    ap_first = xml_parse_time(args).toTime_t();
   }
 }